package cn.com.demo.common.vo;

import cn.com.demo.common.enums.ErrorCodeEnum;
import lombok.Data;

import java.io.Serializable;

@Data
public class BaseRepVo implements Serializable {
    private String code;
    private String msg;
    private Object data;
    public BaseRepVo(){
        this(ErrorCodeEnum.SUCCESS);
    }

    public BaseRepVo(ErrorCodeEnum success) {
        this.code = success.getCode();
        this.msg = success.getMsg();
    }
    public BaseRepVo(Object data) {
        this();
        this.data = data;
    }
    public static BaseRepVo SUCCESS = new BaseRepVo();
    public static BaseRepVo FAIL = new BaseRepVo(ErrorCodeEnum.FAIL);
    public static BaseRepVo UNAUTH = new BaseRepVo(ErrorCodeEnum.UNAUTH);
    public static BaseRepVo FORBIDDEN = new BaseRepVo(ErrorCodeEnum.FORBIDDEN);
}
